import glob
import re


def getfile():
    file = glob.glob("word counts.py")
    return file  # 返回文件名字


code, note, empty = 0, 0, 0
filepath = getfile()
for path in filepath:
    with open(path, encoding='utf-8') as f:
        for line in f:
            if line.isspace():
                empty += 1
            elif re.findall(r'^#', line.strip()):
                print(line)
                note += 1
            elif re.findall(r'#.*[\u4e00-\u9fa5]+.*', line):
                note += 1
                code += 1
            else:
                code += 1

print('empty %s' % empty)
print('note %s' % note)
print('code %s' % code)
